package io.bloom.cloud.config;

import java.util.Date;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@RefreshScope
@Controller
@SpringBootApplication
public class Application {

	@RequestMapping("/")
	@ResponseBody
	public String index(){
		return String.format("user.role:%s,time:%s", userRole, new Date());
	}

	@Value("${user.role:Role default}")
    private String userRole;

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
}
